/*
 *    Copyright (c) 2018-2025, bfcloud All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: bfcloud
 */

import request from '@/router/axios'

export function fetchList(query) {
  return request({
    url: '/ceping/cepinghdglxpxxb/page',
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: '/ceping/cepinghdglxpxxb',
    method: 'post',
    data: obj
  })
}

export function getObj(id) {
  return request({
    url: '/ceping/cepinghdglxpxxb/' + id,
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: '/ceping/cepinghdglxpxxb/' + id,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: '/ceping/cepinghdglxpxxb',
    method: 'put',
    data: obj
  })
}
/* 会议票汇总 */
export function getHdhzApi(hdId){
  return request({
    url: '/ceping/cepinghdglxpxxb/getHdhz/' + hdId,
    method: 'get'
  })
}
/* 会议票汇总带分页 */
export function getHdhzPage(query){
  return request({
    url: '/ceping/cepinghdglxpxxb/getHdhzPage',
    method: 'get',
    params:query
  })
}
/* 测评票汇总 */
export function getCpphzApi(hdId,cppId){
  return request({
    url: '/ceping/cepinghdglxpxxb/getCpphz/' + hdId +'/' +cppId,
    method: 'get'
  })
}



/**
 * 我的选票
 * @param id 会议ID
 * @returns {*}
 */
export function wdXuanPiao(id) {
  return request({
    url: '/ceping/anonymous/cepinghdglxpxxb/wdXuanPiao/' + id,
    method: 'get'
  })
}

/**
 * 我的选票
 * @param xpCode 主票票号
 * @returns {*}
 */
export function wdXuanPiaoXp(xpCode) {
  return request({
    url: '/ceping/anonymous/cepinghdglxpxxb/wdXuanPiaoXp/' + xpCode,
    method: 'get'
  })
}

/**
 * 我的选票
 * @param xpCode 主票票号
 * @returns {*}
 */
export function wdXuanPiaoXpAll(xpCode) {
  return request({
    url: '/ceping/anonymous/cepinghdglxpxxb/wdXuanPiaoXpAll/' + xpCode,
    method: 'get'
  })
}

/**
 * 选票详细信息
 * @param id 选票ID
 * @returns {*}
 */
export function xpInfo(id) {
  return request({
    url: '/ceping/anonymous/cepinghdglxpxxb/xpInfo/' + id,
    method: 'get'
  })
}

/**
 * 选票详细（等次）信息
 * @param id 选票ID
 * @returns {*}
 */
export function xpInfoDc(id) {
  return request({
    url: '/ceping/anonymous/cepinghdglxpxxb/xpInfoDc/' + id,
    method: 'get'
  })
}

/**
 * 打分记录（测评项）
 * @param obj Obj(String xpCode, String cxpCode, int xpId, int dfId, int fzId, String fzName, Double fzFz)
 * @param xpCode 主票号
 * @param cxpCode 次票号
 * @param xpId 选票ID
 * @param dfId 打分ID
 * @param fzId 分值项ID
 * @param fzName 分值项名称
 * @param fzFz 分值分值
 * @returns {*}
 */
export function daFenCp(obj) {
  return request({
    url: '/ceping/anonymous/cepinghdglxpxxb/daFenCp',
    method: 'post',
    params: obj
  })
}

/**
 * 打分记录（等次项）
 * @param obj Obj(String xpCode, String cxpCode, int xpId, int dfId, int dcId, String dcName, Double dcFz)
 * @param xpCode 主票号
 * @param cxpCode 次票号
 * @param xpId 选票ID
 * @param dfId 打分ID
 * @param dcId 等次项ID
 * @param dcName 等次项名称
 * @param dcFz 等次分值
 * @returns {*}
 */
export function daFenDj(obj) {
  return request({
    url: '/ceping/anonymous/cepinghdglxpxxb/daFenDj',
    method: 'post',
    params: obj
  })
}

/**
 * 提交选票（按话动）
 * @param hdId 话动ID
 * @returns {*}
 */
export function tiJiaoHd(hdId) {
  return request({
    url: '/ceping/anonymous/cepinghdglxpxxb/tiJiaoHd',
    method: 'post',
    params: {hdId: hdId}
  })
}

/**
 * 提交选票（按主票号）
 * @param hdId 话动ID
 * @param xpCode 主票号
 * @returns {*}
 */
export function tiJiaoXpCode(hdId, xpCode) {
  return request({
    url: '/ceping/anonymous/cepinghdglxpxxb/tiJiaoXpCode',
    method: 'post',
    params: {hdId: hdId, xpCode: xpCode}
  })
}

/**
 * 提交选票（按次票号）
 * @param hdId 话动ID
 * @param cxpCode 次票号
 * @returns {*}
 */
export function tiJiaoCxpCode(hdId, cxpCode) {
  return request({
    url: '/ceping/anonymous/cepinghdglxpxxb/tiJiaoCxpCode',
    method: 'post',
    params: {hdId: hdId, cxpCode: cxpCode}
  })
}

/**
 * 获取会议的匿名票信息
 * @param hdId 会议ID
 * @returns {*}
 */
export function huoDongNMP(hdId) {
  return request({
    url: '/ceping/anonymous/cepinghdglxpxxb/huoDongNMP/'+hdId,
    method: 'get'
  })
}

export function queryBcpUserSzbg(obj) {
  return request({
    url: '/ceping/anonymous/queryBcpUserSzbg',
    headers: {
      post:{
        "Content-Type":"applicationb/json"
      }
    },
    method: 'post',
    data: obj
  })
}
